#include<sys/types.h>
#include<sys/wait.h>
#include<stdio.h>
#include<unistd.h>

int main(){
	pid_t pid;
	int status = 0;
	pid = fork();

	if (pid < 0){
		perror("fork error");
		return 0;
	}

	if (pid == 0){
		printf("child pid is %d\n", getpid());
		return 99;
	}else{
		pid = wait(&status);
		if (WIFEXITED(status)){
			printf("pid %d has kill with status is %d\n", pid, WEXITSTATUS(status));
		}else{
			printf("pid %d has kill with status is 0", pid);
		}
	}

	return 11;
}
